/*
 *  CANHAS.h
 *  TubeTruck
 *
 *  Created by Aeturnum on 6/4/08.
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
 *
 */

#include <vector>
#include <exception>

#include "Packet.h"
#include "smartalloc_wrap.h"
#include "TubeTruckTypes.h"
#include "RSA.h"
#include "Hashing.h"

namespace TTP {
   class CANHAS : public Packet, public Crypt::Hashing {
   protected:
      std::vector<byte> mMyKey, mGroupKey;
   public:
      
      CANHAS();
      CANHAS(id_hash, std::vector<byte>&, std::vector<byte>&);
      ~CANHAS();
      
      std::vector<byte> getMyPublicKey() const;
      std::vector<byte> getGroupPublicKey() const;
      
      // modifiers
      void setMyPublicKey(std::vector<byte>&);
      void setGroupPublicKey(std::vector<byte>&);
      
      // idhash
      void  setSourceIdHash(id_hash);
      id_hash getSourceIdHash() const;
      
      //inherited
      void fromVec(std::vector<byte>::const_iterator &vit, std::vector<byte>::const_iterator &end);
      void toVec(std::vector<byte> &vec) const;
      
      std::vector<byte> getHashablePacket() const;
   };
}